<!DOCTYPE html>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>
<%@include file="mensagem.jsp" %>

<script src="<c:url value="/recursos/js/registro.js"/>"></script>
<header id="head" class="secondary"></header>
<div class="container">
	<div class="row">
		<article class="col-xs-12 maincontent">
			<header class="page-header">
				<h1 class="page-title">Registro</h1>
			</header>
			<div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
				<div class="panel panel-default">
					<div class="panel-body">
						<h3 class="thin text-center">Registro</h3>
						<hr>
						<sf:form modelAttribute="usuario" action="incluirUsuario" id="formRegistro">
							<input type="hidden" id="registroInvalido" value="${registroInvalido}">
							
							<div class="top-margin">
								<label for="login">Login</label>
								<sf:errors path="login" cssClass="erro"/>
								<sf:input path="login" class="form-control"/>
							</div>
							<div class="top-margin">
								<label for="nome">Nome Completo:<sf:errors path="nome" cssClass="erro"/></label>
								<sf:input path="nome" class="form-control"/>
							</div>
							<div class="top-margin">
								<label for="email">Email<span class="text-danger"> *</span></label>
								<sf:errors path="email" cssClass="erro"/>
								<sf:input path="email" class="form-control"/>
							</div>

							<div class="row top-margin">
								<div class="col-sm-6">
									<label for="senha">Senha <span class="text-danger">*</span></label>
									<sf:password path="senha" class="form-control"/>
								</div>
								<div class="col-sm-6">
									<label>Confirma Senha <span class="text-danger">*</span></label>
									<sf:password path="confirmaSenha" class="form-control" onkeypress="if(event.keyCode == 13) validarRegistro()"/>
								</div>
							</div>
							<hr>
							<div class="row">
								<div class="col-lg-8"></div>
								<div class="col-lg-4 text-right">
									<button class="btn btn-default" type="button" onclick="validarRegistro()">Resgistro</button>
								</div>
							</div>
						</sf:form>
					</div>
					<div class="panel-body" style="display: none;">
						<form style="margin-top: 1.0em;" action="<c:url value="/j_spring_security_check"/>" method="post" id="formLogin">
							<div class="top-margin">
								<label>Login <span class="text-danger">*</span></label>
								<input type="text" name="j_username" class="form-control" value="${j_username}">
							</div>
							<div class="top-margin">
								<label>Senha <span class="text-danger">*</span></label>
								<input type="password" name="j_password" class="form-control" value="${j_password}">
							</div>
						</form>
					</div>
				</div>
			</div>
		</article>
	</div>
</div>